package util;

import java.io.File;
import java.util.HashMap;
import java.util.LinkedList;

public class SaveManager{
	
	XmlParser parser;
	
	public SaveManager(){
		parser = new XmlParser(new File("savedResults.xml"));
	}

	
	public void addSave(HashMap<String, Double> valueMap, int targetId, String name){
		savedResultWrapper newSavedResult = new savedResultWrapper();
		newSavedResult.setName(name).setTargetId(targetId).setValueMap(valueMap);
		parser.addEntry(newSavedResult);
	}
	
	public void removeSave(int id){
		parser.remove(id);
	}
	
	public LinkedList<savedResultWrapper> getSaveList(){
		return parser.readAll();
	}
	
	public savedResultWrapper getSave(int id){
		return parser.getById(id);
	}
}
